import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkProdCategoryRelVO, ParkProdCategoryRelForm, ParkProdCategoryRelQuery } from '@/api/park/parkProdCategoryRel/types';

/**
 * 查询分类产品关联列表
 * @param query
 * @returns {*}
 */

export const listParkProdCategoryRel = (query?: ParkProdCategoryRelQuery): AxiosPromise<ParkProdCategoryRelVO[]> => {
  return request({
    url: '/park/parkProdCategoryRel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询分类产品关联详细
 * @param categoryId
 */
export const getParkProdCategoryRel = (categoryId: string | number): AxiosPromise<ParkProdCategoryRelVO> => {
  return request({
    url: '/park/parkProdCategoryRel/' + categoryId,
    method: 'get'
  });
};

/**
 * 新增分类产品关联
 * @param data
 */
export const addParkProdCategoryRel = (data: ParkProdCategoryRelForm) => {
  return request({
    url: '/park/parkProdCategoryRel',
    method: 'post',
    data: data
  });
};

/**
 * 修改分类产品关联
 * @param data
 */
export const updateParkProdCategoryRel = (data: ParkProdCategoryRelForm) => {
  return request({
    url: '/park/parkProdCategoryRel',
    method: 'put',
    data: data
  });
};

/**
 * 删除分类产品关联
 * @param categoryId
 */
export const delParkProdCategoryRel = (categoryId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkProdCategoryRel/' + categoryId,
    method: 'delete'
  });
};
